<?php
/**
 * Function:
 * Description:
 * Abo 2018/11/5 21:30
 * Email: abo2013@foxmail.com
 */

namespace app\admin\controller;


use app\common\lib\Util;
use think\process\Utils;

class Image
{
    public function index() {
        $file = request()->file( 'file' );
        $info = $file->move( __DIR__ . '/../../../public/static/upload' );
        if ( $info ) {
            $data = [
                'image' => 'http://127.0.0.1:8811/upload/' . $info->getSaveName()
            ];

            return Util::show( true, 'OK', $data );
        }else{
            return Util::show( false, 'error' );
        }
    }
}